package cn.itcast.maven.controller;

import cn.itcast.maven.pojo.Items;
import cn.itcast.maven.service.ItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
@RequestMapping("/items")
public class ItemsController {


    @Autowired
    private ItemsService itemsService;

    @RequestMapping("/showItem")
    public String findById(Integer id, Model model){
        Items item = itemsService.findById(id);
        model.addAttribute("item", item);
        return "itemView";
    }
}
